// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  const wxContext = cloud.getWXContext()
  const _ = cloud.database().command
  type = event.type
  Num = event.Num
  Num = Num+1
  orderNum = event.orderNum
  openid = event.openid
  db = cloud.database().collection('All-Orders')
  .where({openid:openid})
  if(type==1){
  return db.update({
    data:{
      'Not.NotNum':Num,
      'Not.NotID':_.push(orderNum)
    }
  })
 }else{
  return db.update({
    data:{
      'Sell.SellNum':Num,
      'Sell.SellID':_.push(orderNum)
    }
  })
 }
}